home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!news
- From: philma@ix.netcom.com(Phil Majtan)
- Newsgroups: comp.lang.c++
- Subject: Re: main()
- Date: 18 Apr 1996 00:35:49 GMT
- Organization: Netcom
- Message-ID: <4l42p5$p50@dfw-ixnews1.ix.netcom.com>
- References: <3174c0dc.7652220@news.flex.com.au>
- NNTP-Posting-Host: det-mi4-14.ix.netcom.com
- X-NETCOM-Date: Wed Apr 17 7:35:49 PM CDT 1996
-
- In <3174c0dc.7652220@news.flex.com.au> cobweb@flex.com.au (Tony L)
- writes:
- >
- >Hi all,
- >
- >I have come across two different ways that 2 different beginners books
- >recommend that every program should start. Could someone please tell
- >me which one is the "BEST" or proper way?
- >
- >#include <stdio.h>
- >void main()
- >{
- > printf("Hello!\n");
- > return 0;
- >}
- >
- >Or, the same as above but not include "void":
- >
- >#include <stdio.h>
- >main()
- >{
- > printf("Hello!\n");
- > return 0;
- >}
- >
- >As I am just really starting out in "C", I'd like to get off to the
- >right way. :-)
- >
- I have never seen a difference, but I've heard that with C you should
- just use main(). If using C++, use void main(), since C++ gets picky
- about types.
- I guess also that you shouldn't have a return value for a void type
- function. Some compilers may give a warning about that.
- Phil
-
-